<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>编辑指令模板</title>
	<#include "/common/resource.ftl">
	<script type="text/javascript" charset="utf-8" src="${params.contextPath}/common/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8" src="${params.contextPath}/common/ueditor/ueditor.all.js"></script>
	<script type="text/javascript" charset="utf-8" src="${params.contextPath}/common/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript">
        $(function () {
        });
    </script>
</head>
<body>
<div class="ui-form" style="padding: 20px;padding-top: 10px;">
    <form class="layui-form my-form ajax-form" action="${params.contextPath}/web/instructionTemplate/<#if (params.id)??>modify<#else>save</#if>.json" method="post">
        <input type="hidden" name="id" value="${params.id}"/>
        <input type="hidden" name="inputListStr"/>
        <!-- <div class="layui-form-item" style="clear: none;width: 48%;float: left">
            <label class="layui-form-label">指令类型<span class="ui-request">*</span></label>
            <div class="layui-input-block">
                <select name="type">
                	<option value="">--选择指令类型--</option>
                	<option value="1">工作指令</option>
                	<option value="2">情报预警指令</option>
                	<option value="3">情报采集指令</option>
                	<option value="4">核查指令</option>
                	<option value="5">通报指令</option>
                	<option value="6">其它指令</option>
                </select>
            </div>
        </div> -->
        <div class="layui-form-item" style="clear: none;width: 50%;float: left">
            <label class="layui-form-label">模板名称<span class="ui-request">*</span></label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" placeholder="请输入模板名称,可输入50个字符" name="name" maxlength="50">
            </div>
        </div>
        
        <div class="layui-form-item" style="clear: none;width: 50%;float: left">
            <label class="layui-form-label">排序号<span class="ui-request">*</span></label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" placeholder="请输入显示序号" name="orderNum" maxlength="50">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">说明</label>
            <div class="layui-input-block">
                <input class="layui-input" name="remark" placeholder="说明，可输入200个字符" maxlength="200" />
            </div>
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label">模板正文<span class="ui-request">*</span></label>
            <div class="layui-input-block">
                <script type="text/plain" id="myEditor" name="content" style="width:647px;height:300px;"></script>
            </div>
        </div>
        
        <div class="layui-form-item" style="padding-top: 10px;text-align: center;">
            
                <input type="submit" value="保 存" class="layui-btn"/>
            
        </div>
    </form>
</div>
<script>

var ue=null;
$(function(){   //模板正文内容回显操作
	ue = ue||UE.getEditor('myEditor');
	<#if (params.id)??> 
    $.ajaxRequest({   //回显数据
        url: '${params.contextPath}/web/instructionTemplate/query.json',
        data: {id: "${params.id}"},
        success: function (data) {
            if (!data.success) {
                $.message(data.message);
                return;
            }
            var record = data.data;
            for (var key in record) {
                $("[name='" + key + "']").val(record[key]);
                if(key=='content'){ //模板正文内容回显
                	ue.ready(function(){ 
                    	ue.setContent(record['content']);
                    });
                }
            }
        }
    });
</#if>
});
</script>
</body>
</html>
